﻿// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Website: https://www.blazor.zone or https://argozhang.github.io/

namespace SupperTreeSample.Shared.Data;

internal static class FoodGenerator
{
    public static IEnumerable<Ingredient> GenerateIngredient() => new List<Ingredient>()
    {
        new()
        {
            Name = "牛肉1",
            Attributes = new List<KeyValuePair<string, string>>()
            {
                new("6-8 岁", "10 克"),
                new("9-11 岁", "15 克"),
                new("12-14 岁", "20 克"),
                new("15-17 岁", "30 克")
            }
        },
        new()
        {
            Name = "土豆1",
            Attributes = new List<KeyValuePair<string, string>>()
            {
                new("6-8 岁", "10 克"),
                new("9-11 岁", "15 克"),
                new("12-14 岁", "20 克"),
                new("15-17 岁", "30 克")
            }
        },
        new()
        {
            Name = "牛肉2",
            Attributes = new List<KeyValuePair<string, string>>()
            {
                new("6-8 岁", "10 克"),
                new("9-11 岁", "15 克"),
                new("12-14 岁", "20 克"),
                new("15-17 岁", "30 克")
            }
        },
        new()
        {
            Name = "土豆2",
            Attributes = new List<KeyValuePair<string, string>>()
            {
                new("6-8 岁", "10 克"),
                new("9-11 岁", "15 克"),
                new("12-14 岁", "20 克"),
                new("15-17 岁", "30 克")
            }
        }
    };

    public static List<Food> GenerateFoods() => new()
    {
        new()
        {
            Name = "红烧牛肉",
            Ingredients = new List<Ingredient>()
            {
                new()
                {
                    Name = "牛肉",
                    Attributes = new List<KeyValuePair<string, string>>()
                    {
                        new("6-8 岁", "10 克"),
                        new("9-11 岁", "15 克"),
                        new("12-14 岁", "20 克"),
                        new("15-17 岁", "30 克")
                    }
                },
                new()
                {
                    Name = "土豆",
                    Attributes = new List<KeyValuePair<string, string>>()
                    {
                        new("6-8 岁", "10 克"),
                        new("9-11 岁", "15 克"),
                        new("12-14 岁", "20 克"),
                        new("15-17 岁", "30 克")
                    }
                },
                new()
                {
                    Name = "青椒",
                    Attributes = new List<KeyValuePair<string, string>>()
                    {
                        new("6-8 岁", "10 克"),
                        new("9-11 岁", "15 克"),
                        new("12-14 岁", "20 克"),
                        new("15-17 岁", "30 克")
                    }
                },
                new()
                {
                    Name = "胡萝卜",
                    Attributes = new List<KeyValuePair<string, string>>()
                    {
                        new("6-8 岁", "11 克"),
                        new("9-11 岁", "16 克"),
                        new("12-14 岁", "21 克"),
                        new("15-17 岁", "31 克")
                    }
                }
            }
        },
        new()
        {
            Name = "鱼香肉丝",
            Ingredients = new List<Ingredient>()
            {
                new()
                {
                    Name = "猪肉",
                    Attributes = new List<KeyValuePair<string, string>>()
                    {
                        new("6-8 岁", "10 克"),
                        new("9-11 岁", "15 克"),
                        new("12-14 岁", "20 克"),
                        new("15-17 岁", "30 克")
                    }
                },
                new()
                {
                    Name = "土豆",
                    Attributes = new List<KeyValuePair<string, string>>()
                    {
                        new("6-8 岁", "10 克"),
                        new("9-11 岁", "15 克"),
                        new("12-14 岁", "20 克"),
                        new("15-17 岁", "30 克")
                    }
                },
                new()
                {
                    Name = "青椒",
                    Attributes = new List<KeyValuePair<string, string>>()
                    {
                        new("6-8 岁", "10 克"),
                        new("9-11 岁", "15 克"),
                        new("12-14 岁", "20 克"),
                        new("15-17 岁", "30 克")
                    }
                },
                new()
                {
                    Name = "胡萝卜",
                    Attributes = new List<KeyValuePair<string, string>>()
                    {
                        new("6-8 岁", "10 克"),
                        new("9-11 岁", "15 克"),
                        new("12-14 岁", "20 克"),
                        new("15-17 岁", "30 克")
                    }
                }
            }
        },
        new()
        {
            Name = "干锅花菜",
            Ingredients = new List<Ingredient>()
            {
                new()
                {
                    Name = "花菜",
                    Attributes = new List<KeyValuePair<string, string>>()
                    {
                        new("6-8 岁", "10 克"),
                        new("9-11 岁", "15 克"),
                        new("12-14 岁", "20 克"),
                        new("15-17 岁", "30 克")
                    }
                },
                new()
                {
                    Name = "土豆",
                    Attributes = new List<KeyValuePair<string, string>>()
                    {
                        new("6-8 岁", "10 克"),
                        new("9-11 岁", "15 克"),
                        new("12-14 岁", "20 克"),
                        new("15-17 岁", "30 克")
                    }
                },
                new()
                {
                    Name = "青椒",
                    Attributes = new List<KeyValuePair<string, string>>()
                    {
                        new("6-8 岁", "10 克"),
                        new("9-11 岁", "15 克"),
                        new("12-14 岁", "20 克"),
                        new("15-17 岁", "30 克")
                    }
                },
                new()
                {
                    Name = "胡萝卜",
                    Attributes = new List<KeyValuePair<string, string>>()
                    {
                        new("6-8 岁", "10 克"),
                        new("9-11 岁", "15 克"),
                        new("12-14 岁", "20 克"),
                        new("15-17 岁", "30 克")
                    }
                }
            }
        }
    };

    public static Ingredient NewIngredient(Ingredient value)
    {
        var ingre = new Ingredient();
        var attrs = new List<KeyValuePair<string, string>>();
        foreach (var attr in value.Attributes)
        {
            attrs.Add(new(attr.Key, ""));
        }
        ingre.Attributes = attrs;
        return ingre;
    }

    public static List<FoodTimeNode> GenerateTimes() => new()
    {
        new()
        {
            Name = "早餐",
            Foods = GenerateFoods()
        },
        new()
        {
            Name = "中餐",
            Foods = GenerateFoods()
        },
        new()
        {
            Name = "晚餐",
            Foods = GenerateFoods()
        }
    };

    public static List<FoodDayNode> GenerateDays() => new()
    {
        new()
        {
            Name = "第一天",
            Nodes = GenerateTimes()
        }
    };
}

